import 'package:p_location/home/obj/obj_alarm_info.dart';

import 'alarm_type_num.dart';

class HomeAlarmInfoDetail {
    int alarmAllCount;
    List<AlarmTypeNum> alarmTypeNum;
    int areaAlarmAllCount;
    int jobAlarmAllCount;
    List<ObjAlarmInfo> list;
    int vehicleAlarmAllCount;

    HomeAlarmInfoDetail({this.alarmAllCount, this.alarmTypeNum, this.areaAlarmAllCount, this.jobAlarmAllCount, this.list, this.vehicleAlarmAllCount});

    factory HomeAlarmInfoDetail.fromJson(Map<String, dynamic> json) {
        return HomeAlarmInfoDetail(
            alarmAllCount: json['alarmAllCount'], 
            alarmTypeNum: json['alarmTypeNum'] != null ? (json['alarmTypeNum'] as List).map((i) => AlarmTypeNum.fromJson(i)).toList() : null, 
            areaAlarmAllCount: json['areaAlarmAllCount'], 
            jobAlarmAllCount: json['jobAlarmAllCount'], 
            list: json['list'] != null ? (json['list'] as List).map((i) => ObjAlarmInfo.fromJson(i)).toList() : null,
            vehicleAlarmAllCount: json['vehicleAlarmAllCount'], 
        );
    }

    Map<String, dynamic> toJson() {
        final Map<String, dynamic> data = new Map<String, dynamic>();
        data['alarmAllCount'] = this.alarmAllCount;
        data['areaAlarmAllCount'] = this.areaAlarmAllCount;
        data['jobAlarmAllCount'] = this.jobAlarmAllCount;
        data['vehicleAlarmAllCount'] = this.vehicleAlarmAllCount;
        if (this.alarmTypeNum != null) {
            data['alarmTypeNum'] = this.alarmTypeNum.map((v) => v.toJson()).toList();
        }
        if (this.list != null) {
            data['list'] = this.list.map((v) => v.toJson()).toList();
        }
        return data;
    }
}